package com.example.javapoint.threads.setname;

/*
使用构造方法设置线程名
 */
class SonThread extends Thread {
    @Override
    public void run() {
        System.out.println("SonThread is running...");
    }

    SonThread(String name){
        super(name);
    }
}
public class NamingThread {
    public static void main(String[] args) {
        SonThread tencent = new SonThread("tencent");
        SonThread tencent2 = new SonThread("tencent2");

        tencent.start();
        tencent2.start();

        System.out.println("current thread is running with name " + tencent.getName());
        System.out.println("current thread is running with name " + tencent2.getName());
    }
}
